const express=require('express')

const morgan=require('morgan')
const cors=require('cors')
const app=express()

app.use(morgan('dev'))
app.use(cors())
app.use(express.json())

const PORT=process.env.PORT||3000

app.get('/',(req,res)=>{
  res.send('Hello express')
})

app.listen(PORT,()=>{
  console.log(`Server running at http://localhost:${PORT}`)
})
var mysql = require('mysql')
var connection = mysql.createConnection({
  host: 'localhost',
  user: 'zydbuser',
  password: 'zydb.123',
  database: 'sdzy_erp',
  port:'3306'
})

connection.connect()

connection.query('SELECT 1 + 1 AS solution', function (err, rows, fields) {
  if (err) throw err

  console.log('The solution is: ', rows[0].solution)
})

connection.end()